package com.probiz.estore.common.model.catalog.base;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.probiz.estore.common.model.catalog.VirtualCategory;
import com.probiz.estore.common.model.catalog.VirtualcatProdRelation;
import com.probiz.estore.core.model.BaseObject;

/**
 * VirtualCategory Base Java Bean, base class for the model, mapped directly to database table
 * 
 * Avoid changing this file if not necessary, will be overwritten. 
 *
 */
public class VirtualCategoryTbl extends BaseObject implements Serializable {

    protected Integer categoryId;
	protected Short categoryType;
	protected String categoryCode;
	protected String categoryName;
	protected String categoryDescription;
	protected String keywords;
	protected String metaDescription;
	protected String templatePath;
	protected Short depth;
	protected Short hasChildren;
	protected String parentPath;
	protected String categoryPath;
	protected String imageUrl;
	protected Integer sortOrder;
	protected Short status;
	protected String fcProductTypes;
	protected String fcProductCategories;
	protected String fcBrands;
	protected String fcTags;
	protected String fcKeywords;
	protected java.math.BigDecimal fcLowestPrice;
	protected java.math.BigDecimal fcHighestPrice;
	protected String linkUrl;
	protected Short linkTarget;
	protected String displayFlag;
	protected Integer itemCount;
	protected Integer activeItemCount;
	protected Integer createBy;
	protected Integer updateBy;
	protected java.util.Date createTime;
	protected java.util.Date updateTime;
	protected Integer version;
	protected VirtualCategory parent;
	protected Set children = new java.util.HashSet();
	protected Set<VirtualcatProdRelation> virtualcatProdRelations = new HashSet<VirtualcatProdRelation>();
	/**
	 * Default Empty Constructor for class VirtualCategory
	 */
	public VirtualCategoryTbl () {
		super();
	}
	
	/**
	 * Default Key Fields Constructor for class VirtualCategory
     * @param  in_categoryId 目录id
	 */
	public VirtualCategoryTbl (Integer in_categoryId) {
		this.setCategoryId(in_categoryId);
    }


    public VirtualCategory getParent() {
        return parent;
    }

    public void setParent(VirtualCategory parent) {
        this.parent = parent;
    }

    public Set getChildren() {
        return children;
    }

    public void setChildren(Set children) {
        this.children = children;
    }
    
    

    public Set<VirtualcatProdRelation> getVirtualcatProdRelations() {
		return virtualcatProdRelations;
	}

	public void setVirtualcatProdRelations(
			Set<VirtualcatProdRelation> virtualcatProdRelations) {
		this.virtualcatProdRelations = virtualcatProdRelations;
	}

	/**
	 * 	 * @return Integer
     * @hibernate.id column="categoryId" type="java.lang.Integer" generator-class="native"
	 */
	public Integer getCategoryId() {
		return this.categoryId;
	}
	
	/**
	 * Set the categoryId
	 */	
	public void setCategoryId(Integer aValue) {
		this.categoryId = aValue;
	}	

	/**
	 * 父目录id	 * @return Integer
	 */
	public Integer getParentId() {
		return this.getParent()==null?null:this.getParent().getCategoryId();
	}
	
	/**
	 * Set the parentId
	 */	
	public void setParentId(Integer aValue) {
	    if (aValue==null) {
	    	parent = null;
	    } else {
	        parent = new VirtualCategory(aValue);
	        parent.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
	    }
	}	

	/**
	 * 1 商品专场目录
            2 链接类型目录	 * @return Short
	 * @hibernate.property column="categoryType" type="java.lang.Short" length="5" not-null="false" unique="false"
	 */
	public Short getCategoryType() {
		return this.categoryType;
	}
	
	/**
	 * Set the categoryType
	 */	
	public void setCategoryType(Short aValue) {
		this.categoryType = aValue;
	}	

	/**
	 * 目录编码，ak，主要用于url生成。	 * @return String
	 * @hibernate.property column="categoryCode" type="java.lang.String" length="32" not-null="true" unique="false"
	 */
	public String getCategoryCode() {
		return this.categoryCode;
	}
	
	/**
	 * Set the categoryCode
	 * @spring.validator type="required"
	 */	
	public void setCategoryCode(String aValue) {
		this.categoryCode = aValue;
	}	

	/**
	 * 目录名称	 * @return String
	 * @hibernate.property column="categoryName" type="java.lang.String" length="128" not-null="true" unique="false"
	 */
	public String getCategoryName() {
		return this.categoryName;
	}
	
	/**
	 * Set the categoryName
	 * @spring.validator type="required"
	 */	
	public void setCategoryName(String aValue) {
		this.categoryName = aValue;
	}	

	
	public String getCategoryDescription() {
		return categoryDescription;
	}

	public void setCategoryDescription(String categoryDescription) {
		this.categoryDescription = categoryDescription;
	}

	

	public String getKeywords() {
		return keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	/**
	 * meta描述	 * @return String
	 * @hibernate.property column="metaDescription" type="java.lang.String" length="256" not-null="false" unique="false"
	 */
	public String getMetaDescription() {
		return this.metaDescription;
	}
	
	/**
	 * Set the metaDescription
	 */	
	public void setMetaDescription(String aValue) {
		this.metaDescription = aValue;
	}	

	/**
	 * 模板路径	 * @return String
	 * @hibernate.property column="templatePath" type="java.lang.String" length="128" not-null="false" unique="false"
	 */
	public String getTemplatePath() {
		return this.templatePath;
	}
	
	/**
	 * Set the templatePath
	 */	
	public void setTemplatePath(String aValue) {
		this.templatePath = aValue;
	}	

	/**
	 * 深度	 * @return Short
	 * @hibernate.property column="depth" type="java.lang.Short" length="5" not-null="false" unique="false"
	 */
	public Short getDepth() {
		return this.depth;
	}
	
	/**
	 * Set the depth
	 */	
	public void setDepth(Short aValue) {
		this.depth = aValue;
	}	

	/**
	 * 是否有子目录
            1=有
            0=无	 * @return Short
	 * @hibernate.property column="hasChildren" type="java.lang.Short" length="5" not-null="false" unique="false"
	 */
	public Short getHasChildren() {
		return this.hasChildren;
	}
	
	/**
	 * Set the hasChildren
	 */	
	public void setHasChildren(Short aValue) {
		this.hasChildren = aValue;
	}	

	
	public String getParentPath() {
		return parentPath;
	}

	public void setParentPath(String parentPath) {
		this.parentPath = parentPath;
	}

	/**
	 * @hibernate.property column="categoryPath" type="java.lang.String" length="32" not-null="false" unique="false"
	 */
	public String getCategoryPath() {
		return this.categoryPath;
	}
	
	/**
	 * Set the categoryPath
	 */	
	public void setCategoryPath(String aValue) {
		this.categoryPath = aValue;
	}	

	/**
	 * 图片url	 * @return String
	 * @hibernate.property column="imageUrl" type="java.lang.String" length="255" not-null="false" unique="false"
	 */
	public String getImageUrl() {
		return this.imageUrl;
	}
	
	/**
	 * Set the imageUrl
	 */	
	public void setImageUrl(String aValue) {
		this.imageUrl = aValue;
	}	

	/**
	 * 排序值，一般值越小，越靠前	 * @return Integer
	 * @hibernate.property column="sortOrder" type="java.lang.Integer" length="10" not-null="true" unique="false"
	 */
	public Integer getSortOrder() {
		return this.sortOrder;
	}
	
	/**
	 * Set the sortOrder
	 * @spring.validator type="required"
	 */	
	public void setSortOrder(Integer aValue) {
		this.sortOrder = aValue;
	}	

	/**
	 * 0=前台不可见
            1=前台可见
            
            
            
            	 * @return Short
	 * @hibernate.property column="status" type="java.lang.Short" length="5" not-null="true" unique="false"
	 */
	public Short getStatus() {
		return this.status;
	}
	
	/**
	 * Set the status
	 * @spring.validator type="required"
	 */	
	public void setStatus(Short aValue) {
		this.status = aValue;
	}	

	/**
	 * 过滤条件：产品类型，以逗号分隔id	 * @return String
	 * @hibernate.property column="fcProductTypes" type="java.lang.String" length="256" not-null="false" unique="false"
	 */
	public String getFcProductTypes() {
		return this.fcProductTypes;
	}
	
	/**
	 * Set the fcProductTypes
	 */	
	public void setFcProductTypes(String aValue) {
		this.fcProductTypes = aValue;
	}	

	/**
	 * 过滤条件：产品目录，以逗号分隔id	 * @return String
	 * @hibernate.property column="fcProductCategories" type="java.lang.String" length="256" not-null="false" unique="false"
	 */
	public String getFcProductCategories() {
		return this.fcProductCategories;
	}
	
	/**
	 * Set the fcProductCategories
	 */	
	public void setFcProductCategories(String aValue) {
		this.fcProductCategories = aValue;
	}	

	/**
	 * 过滤条件：品牌，以逗号分隔id	 * @return String
	 * @hibernate.property column="fcBrands" type="java.lang.String" length="256" not-null="false" unique="false"
	 */
	public String getFcBrands() {
		return this.fcBrands;
	}
	
	/**
	 * Set the fcBrands
	 */	
	public void setFcBrands(String aValue) {
		this.fcBrands = aValue;
	}	

	/**
	 * 过滤条件：标签，以逗号分隔id	 * @return String
	 * @hibernate.property column="fcTags" type="java.lang.String" length="256" not-null="false" unique="false"
	 */
	public String getFcTags() {
		return this.fcTags;
	}
	
	/**
	 * Set the fcTags
	 */	
	public void setFcTags(String aValue) {
		this.fcTags = aValue;
	}	

	/**
	 * 过滤条件：关键词，以逗号分隔	 * @return String
	 * @hibernate.property column="fcKeywords" type="java.lang.String" length="256" not-null="false" unique="false"
	 */
	public String getFcKeywords() {
		return this.fcKeywords;
	}
	
	/**
	 * Set the fcKeywords
	 */	
	public void setFcKeywords(String aValue) {
		this.fcKeywords = aValue;
	}	

	/**
	 * 过滤条件：最低价	 * @return java.math.BigDecimal
	 * @hibernate.property column="fcLowestPrice" type="java.math.BigDecimal" length="12" not-null="false" unique="false"
	 */
	public java.math.BigDecimal getFcLowestPrice() {
		return this.fcLowestPrice;
	}
	
	/**
	 * Set the fcLowestPrice
	 */	
	public void setFcLowestPrice(java.math.BigDecimal aValue) {
		this.fcLowestPrice = aValue;
	}	

	/**
	 * 过滤条件：最高价	 * @return java.math.BigDecimal
	 * @hibernate.property column="fcHighestPrice" type="java.math.BigDecimal" length="12" not-null="false" unique="false"
	 */
	public java.math.BigDecimal getFcHighestPrice() {
		return this.fcHighestPrice;
	}
	
	/**
	 * Set the fcHighestPrice
	 */	
	public void setFcHighestPrice(java.math.BigDecimal aValue) {
		this.fcHighestPrice = aValue;
	}	

	/**
	 * 链接地址 当categoryType=2时候生效	 * @return String
	 * @hibernate.property column="linkUrl" type="java.lang.String" length="255" not-null="false" unique="false"
	 */
	public String getLinkUrl() {
		return this.linkUrl;
	}
	
	/**
	 * Set the linkUrl
	 */	
	public void setLinkUrl(String aValue) {
		this.linkUrl = aValue;
	}	
	

	public Short getLinkTarget() {
		return linkTarget;
	}

	public void setLinkTarget(Short linkTarget) {
		this.linkTarget = linkTarget;
	}

	/**
	 * 自定义的显示标志
            0=标签页
            1= new
            2= hot
            可出现多个，用半角逗号分隔,最末一个也要半角逗号，如 0,2,   1,2,	 * @return String
	 * @hibernate.property column="displayFlag" type="java.lang.String" length="32" not-null="false" unique="false"
	 */
	public String getDisplayFlag() {
		return this.displayFlag;
	}
	
	/**
	 * Set the displayFlag
	 */	
	public void setDisplayFlag(String aValue) {
		this.displayFlag = aValue;
	}	

	/**
	 * 目录下的商品的数量	 * @return Integer
	 * @hibernate.property column="itemCount" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getItemCount() {
		return this.itemCount;
	}
	
	/**
	 * Set the itemCount
	 */	
	public void setItemCount(Integer aValue) {
		this.itemCount = aValue;
	}	

	/**
	 * 前台可见商品个数,即上架商品个数	 * @return Integer
	 * @hibernate.property column="activeItemCount" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getActiveItemCount() {
		return this.activeItemCount;
	}
	
	/**
	 * Set the activeItemCount
	 */	
	public void setActiveItemCount(Integer aValue) {
		this.activeItemCount = aValue;
	}	

	/**
	 * 	 * @return Integer
	 * @hibernate.property column="createBy" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getCreateBy() {
		return this.createBy;
	}
	
	/**
	 * Set the createBy
	 */	
	public void setCreateBy(Integer aValue) {
		this.createBy = aValue;
	}	

	/**
	 * 	 * @return Integer
	 * @hibernate.property column="updateBy" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getUpdateBy() {
		return this.updateBy;
	}
	
	/**
	 * Set the updateBy
	 */	
	public void setUpdateBy(Integer aValue) {
		this.updateBy = aValue;
	}	

	/**
	 * 	 * @return java.util.Date
	 * @hibernate.property column="createTime" type="java.util.Date" length="19" not-null="true" unique="false"
	 */
	public java.util.Date getCreateTime() {
		return this.createTime;
	}
	
	/**
	 * Set the createTime
	 * @spring.validator type="required"
	 */	
	public void setCreateTime(java.util.Date aValue) {
		this.createTime = aValue;
	}	

	/**
	 * 	 * @return java.util.Date
	 * @hibernate.property column="updateTime" type="java.util.Date" length="19" not-null="true" unique="false"
	 */
	public java.util.Date getUpdateTime() {
		return this.updateTime;
	}
	
	/**
	 * Set the updateTime
	 * @spring.validator type="required"
	 */	
	public void setUpdateTime(java.util.Date aValue) {
		this.updateTime = aValue;
	}	

	/**
	 * 	 * @return Integer
	 * @hibernate.property column="version" type="java.lang.Integer" length="10" not-null="true" unique="false"
	 */
	public Integer getVersion() {
		return this.version;
	}
	
	/**
	 * Set the version
	 * @spring.validator type="required"
	 */	
	public void setVersion(Integer aValue) {
		this.version = aValue;
	}	

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof VirtualCategoryTbl)) {
			return false;
		}
		VirtualCategoryTbl rhs = (VirtualCategoryTbl) object;
		return new EqualsBuilder()
				.append(this.categoryId, rhs.categoryId)
						.append(this.categoryType, rhs.categoryType)
				.append(this.categoryCode, rhs.categoryCode)
				.append(this.categoryName, rhs.categoryName)
				.append(this.metaDescription, rhs.metaDescription)
				.append(this.templatePath, rhs.templatePath)
				.append(this.depth, rhs.depth)
				.append(this.hasChildren, rhs.hasChildren)
				.append(this.categoryPath, rhs.categoryPath)
				.append(this.imageUrl, rhs.imageUrl)
				.append(this.sortOrder, rhs.sortOrder)
				.append(this.status, rhs.status)
				.append(this.fcProductTypes, rhs.fcProductTypes)
				.append(this.fcProductCategories, rhs.fcProductCategories)
				.append(this.fcBrands, rhs.fcBrands)
				.append(this.fcTags, rhs.fcTags)
				.append(this.fcKeywords, rhs.fcKeywords)
				.append(this.fcLowestPrice, rhs.fcLowestPrice)
				.append(this.fcHighestPrice, rhs.fcHighestPrice)
				.append(this.linkUrl, rhs.linkUrl)
				.append(this.displayFlag, rhs.displayFlag)
				.append(this.itemCount, rhs.itemCount)
				.append(this.activeItemCount, rhs.activeItemCount)
				.append(this.createBy, rhs.createBy)
				.append(this.updateBy, rhs.updateBy)
				.append(this.createTime, rhs.createTime)
				.append(this.updateTime, rhs.updateTime)
				.append(this.version, rhs.version)
				.isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-82280557, -700257973)
				.append(this.categoryId) 
						.append(this.categoryType) 
				.append(this.categoryCode) 
				.append(this.categoryName) 
				.append(this.metaDescription) 
				.append(this.templatePath) 
				.append(this.depth) 
				.append(this.hasChildren) 
				.append(this.categoryPath) 
				.append(this.imageUrl) 
				.append(this.sortOrder) 
				.append(this.status) 
				.append(this.fcProductTypes) 
				.append(this.fcProductCategories) 
				.append(this.fcBrands) 
				.append(this.fcTags) 
				.append(this.fcKeywords) 
				.append(this.fcLowestPrice) 
				.append(this.fcHighestPrice) 
				.append(this.linkUrl) 
				.append(this.displayFlag) 
				.append(this.itemCount) 
				.append(this.activeItemCount) 
				.append(this.createBy) 
				.append(this.updateBy) 
				.append(this.createTime) 
				.append(this.updateTime) 
				.append(this.version) 
				.toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this)
				.append("categoryId", this.categoryId) 
						.append("categoryType", this.categoryType) 
				.append("categoryCode", this.categoryCode) 
				.append("categoryName", this.categoryName) 
				.append("metaDescription", this.metaDescription) 
				.append("templatePath", this.templatePath) 
				.append("depth", this.depth) 
				.append("hasChildren", this.hasChildren) 
				.append("categoryPath", this.categoryPath) 
				.append("imageUrl", this.imageUrl) 
				.append("sortOrder", this.sortOrder) 
				.append("status", this.status) 
				.append("fcProductTypes", this.fcProductTypes) 
				.append("fcProductCategories", this.fcProductCategories) 
				.append("fcBrands", this.fcBrands) 
				.append("fcTags", this.fcTags) 
				.append("fcKeywords", this.fcKeywords) 
				.append("fcLowestPrice", this.fcLowestPrice) 
				.append("fcHighestPrice", this.fcHighestPrice) 
				.append("linkUrl", this.linkUrl) 
				.append("displayFlag", this.displayFlag) 
				.append("itemCount", this.itemCount) 
				.append("activeItemCount", this.activeItemCount) 
				.append("createBy", this.createBy) 
				.append("updateBy", this.updateBy) 
				.append("createTime", this.createTime) 
				.append("updateTime", this.updateTime) 
				.append("version", this.version) 
				.toString();
	}

	/**
	 * Return the name of the first key column
	 */
	public String getFirstKeyColumnName() {
		return "categoryId";
	}
	
	/**
	 * Return the Id (pk) of the entity, must be Integer
	 */
	public Integer getId() {
		return categoryId;
	}

}